import { Component, OnInit, ViewChild } from '@angular/core';
import { STColumn, STComponent } from '@delon/abc/st';
import { SFButton, SFDateWidgetSchema, SFLayout, SFSchema } from '@delon/form';

@Component({
  templateUrl: './mch.component.html',
  styles: [],
})
export class MchComponent implements OnInit {
  layout: SFLayout = 'inline';
  schema: SFSchema = {
    properties: {
      mch_name: {
        type: 'string',
        title: '商户名称',
        maxLength: 20,
      },
      mch_phone: {
        type: 'string',
        title: '联系方式',
        format: 'mobile',
        minLength: 11,
      },
      extra: {
        type: 'string',
        title: '业务参数',
        maxLength: 20,
      },
      create_time: {
        type: 'string',
        title: '创建时间',
        ui: { widget: 'date', mode: 'range' } as SFDateWidgetSchema,
      },
    },
  };
  button: SFButton = {
    submit: '查询',
    edit: '新增商户',
  };

  params: any = {};
  url = `/user`;
  @ViewChild('st', { static: true })
  st: STComponent;
  searchSchema: SFSchema = {
    properties: {
      no: {
        type: 'string',
        title: '编号',
      },
    },
  };
  columns: STColumn[] = [
    { title: '编号', index: 'no' },
    { title: '调用次数', type: 'number', index: 'callNo' },
    { title: '头像', type: 'img', width: '50px', index: 'avatar' },
    { title: '时间', type: 'date', index: 'updatedAt' },
  ];
  constructor() {}

  ngOnInit(): void {}
}
